package com.guochaojava.config;

import com.lgd.winter.wechat.config.BaseConfig;
import com.lgd.winter.wechat.core.WeChatTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 微信配置类
 *
 * @author guochao
 * @since 1.0.0
 */
@Configuration
public class WeChatConfig {

    @Autowired
    private PropertiesConfig propertiesConfig;

    @Bean
    public WeChatTemplate weChatTemplate() {
        BaseConfig baseConfig = new BaseConfig(propertiesConfig.getWechat().getAppId(), propertiesConfig.getWechat().getAppSecret(), propertiesConfig.getWechat().getMiniAppId(), propertiesConfig.getWechat().getMiniAppSecret());
        WeChatTemplate weChatTemplate = new WeChatTemplate(baseConfig);
        return weChatTemplate;
    }
}